<!--  -->
<template>
  <div>
    <div class="all">
      <div class="musicList">
        <div class="list_wrap">
          <div class="item_wrap">
            <div
              @click="toDetail(item.id)"
              v-for="(item, index) in singerList"
              :key="index"
              class="item"
            >
              <div class="cover">
                <img :src="item.picUrl" alt="" />
              </div>
              <div class="album">{{ item.name }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getSearchList } from "util/findMusic.js";

export default {
  name: "",
  data() {
    return {
      singerList: [],
    };
  },
  created() {
    this.getSearchList();
  },
  methods: {
    async getSearchList() {
      let {
        data: {
          result: { artists },
        },
      } = await getSearchList(this.$route.params.data, 20, 0, 100);
      //   console.log(artists)
      this.singerList = artists;
    },
    toDetail(id) {
      this.$router.push("/singerDetail/" + id);
    },
  },
};
</script>

<style lang='less' scoped>
.musicList {
  padding: 0 5.25rem;
  .list_wrap {
    // width: 80%;
    .item_wrap {
      .item {
        background-color: #fff;
        height: 40px;
        padding: 10px 0;
        display: flex;
        align-items: center;
        border-radius: 10px;
        .cover {
          margin: 0 10px;
          width: 45px;
          height: 45px;
          border-radius: 5px;
          img {
            width: 100%;
            height: 100%;
            border-radius: 5px;
            box-shadow: 2px 2px 12px 4px rgba(0, 0, 0, 0.1);
          }
        }
        .info {
          margin-left: 10px;
          width: 30%;
          .name {
            width: 100%;
            font-weight: 600;
            font-size: 17px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }
          .creator_name {
            color: #525252;
            font-size: 13px;
          }
          .active_position {
            color: #335eea;
          }
        }
        .album {
          color: #525252;
          width: 30%;
          margin-left: 2%;
          font-size: 15px;
          font-weight: 600;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }

      }
      .item:hover {
        background-color: #f6f6f8;
      }
    }
  }
}
.all {
  // padding: 0 5.25rem;
}
.all ul li {
  padding-left: 20px;
  display: flex;
  height: 80px;
  background: #f9f9f9;
  align-items: center;
}
.all ul li:nth-child(2n) {
  background: #fff;
}
.all ul li:hover {
  background: #f0f1f2;
}
.all ul li .rank {
  width: 30px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: #ddd;
}
.all ul li .img {
  width: 60px;
  height: 60px;
  margin-left: 30px;
  margin-right: 10px;
}
.all ul li .img img {
  width: 100%;
  height: 100%;
  border-radius: 6px;
}
.all ul li .name {
  flex: 1;
}
.all ul li .score {
  width: 150px;
  font-size: 12px;
  color: rgb(128, 120, 120);
}
</style>